<template>
  <van-cell :to="'/article/'+article.art_id" class="article-item">
    <div class="title van-multi-ellipsis--l2" slot="title">{{article.title}}</div>
    <div class="article-info" slot="label">
      <div class="cover-wrap" v-if="article.cover.type === 3">
        <div :key="index" class="cover-item" v-for="img,index in article.cover.images">
          <van-image :src="img" class="cover-item-img" fit="cover" />
        </div>
      </div>
      <div class="article-item-label">
        <span>{{article.aut_name}}</span>
        <span>{{article.comm_count}}评论</span>
        <span>{{article.pubdate | relativeTime}}</span>
      </div>
    </div>

    <van-image
      :src="article.cover.images[0]"
      class="right-cover"
      fit="cover"
      slot="default"
      v-if="article.cover.type===1"
    />
  </van-cell>
</template>


<script>
export default {
  name: 'ArticleItem',
  props: {
    article: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="less" scoped>
.article-item {
  .title {
    font-size: 32px;
    color: #3a3a3a;
  }
  .right-cover {
    width: 232px;
    height: 146px;
    margin-left: 25px;
  }
  .van-cell__value {
    flex: unset;
    width: 232px;
    height: 146px;
  }
  .cover-wrap {
    display: flex;
    padding: 30px 0;
    .cover-item {
      flex: 1;
      height: 146px;
      &:not(:last-child) {
        padding-right: 4px;
      }
      .cover-item-img {
        width: 100%;
        height: 146px;
        background-size: cover;
      }
    }
  }
  .article-item-label span {
    padding-right: 20px;
  }
}
</style>